package com.jushu.storbox.handler;

import android.app.Activity;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.jushu.storbox.R;
import com.jushu.storbox.constant.MessageCode;

public class ShareExceptionHandler extends ExceptionHandler {
	

	public ShareExceptionHandler(Activity activity) {
		super(activity);
	}

	public void handleMessage(Message msg) {
		super.handleMessage(msg);
		ProgressBar progressBar = (ProgressBar)activity.findViewById(R.id.share_file_search_ProgressBar);
		ImageView searchButton = (ImageView)activity.findViewById(R.id.share_file_search_imageview);
		switch (msg.arg1) {
		case MessageCode.NETWORK_EXCEPTION:
			progressBar.setVisibility(View.GONE);
			searchButton.setVisibility(View.VISIBLE);
			exceptionMsg(R.string.allfile_notwork_obstructed);
			break;
		case MessageCode.RESULT_IS_EMPTY:
			exceptionMsg(R.string.share_file_not_search_user);
			break;
		case MessageCode.SERVER_REQUEST_FAIL:
			progressBar.setVisibility(View.GONE);
			searchButton.setVisibility(View.VISIBLE);
			exceptionMsg(R.string.share_fail_because_of_invailable_connection);
			break;
		}
	}


}
